<?php


namespace App\Controller\Im;


use App\Controller\AbstractController;
use App\Request\Common\UploadFileRequest;
use App\Request\Im\ImChatRequest;
use App\Service\Im\ImChatService;
use Psr\Http\Message\ResponseInterface;
use Hyperf\Di\Annotation\Inject;


class CommonContronller extends AbstractController
{
    /**
     * @Inject()
     * @var ImChatService
     */
    protected $imchatService;


    /**
     * 获取GoEasy访问otp
     * @return mixed|ResponseInterface
     */
    public function AllocationKey()
    {
        $data = $this->imchatService->goEasyOTP();
        return $this->response->success($data);
    }

    /**
     * 创建会话记录
     * @param ImChatRequest $request
     * @return mixed|ResponseInterface
     */
    public function CreateImChat(ImChatRequest $request)
    {
        $validated = $request->validated();
        $data = $this->imchatService->CreateImChat($validated);
        return $this->response->success($data);
    }


}